<%--
  ~ Copyright (c) 2016. 恒昌互联网运营中心.
  --%>

<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
<meta name="description" cotent="">
<meta name="author" content="">
<title>恒昌-鹰眼监控平台</title>
<%@ include file="/WEB-INF/views/common/include.jsp"%>
<style type="text/css">
body {
	padding-top: 40px;
	padding-bottom: 40px;
	background-color: #eee;
}

.form-signin {
	max-width: 330px;
	padding: 15px;
	margin: 0 auto;
}

.form-signin .form-signin-heading, .form-signin .checkbox {
	margin-bottom: 10px;
}

.form-signin .checkbox {
	font-weight: normal;
}

.form-signin .form-control {
	position: relative;
	height: auto;
	-webkit-box-sizing: bolder-box;
	-moz-box-sizing: bolder-box;
	box-sizing: bolder-box;
	padding: 10px;
	font-size: 16px;
}

.form-signin .form-control:focus {
	z-index: 2;
}

.form-signin input[type="email"] {
	margin-bottom: -1px;
	bolder-bottom-right-radius: 0;
	bolder-bottom-left-radius: 0;
}

.form-signin input[type="password"] {
	margin-bottom: 10px;
	bolder-top-left-radius: 0;
	bolder-top-right-radius: 0;
}
</style>

<script type="text/javascript">



$(document).ready(function(){
	//回车提交事件
	$("#iUserName").keyup(function(e){
		if(e.keyCode==13){
		   $("#iPassword").focus();
		}
	});
	$("#iPassword").keyup(function(e){
		if(e.keyCode==13){
		   $("#loginButton").click();
		}
	});


});

function doLogin(){
	if($("#iUserName").val() == null || $("#iUserName").val()==''){
		alert('请输入用户名!');
		return;
	}
	var iUserName = $("#iUserName").val();

	if($("#iPassword").val() == null || $("#iPassword").val() == ''){
		alert('请输入密码!');
		return;
	}
	var iPassword = $("#iPassword").val();

	$.ajax({
		  url: "<%=request.getContextPath()%>/login/doLogin",
		  type:"post",
		  data: {iUserName:iUserName,iPassword:iPassword},
		  success:validationResults,
		  dataType:"text"
		});
}

function validationResults(result){
	if(result  == '1'){
		window.location = '<%=request.getContextPath()%>/console/main';
	}else{
		$("#iUserName").focus();
		alert('用户名或密码错误,请重新输入！');
	}
}


</script>
</head>
<body id="body">
	<div class="container">

		<form class="form-signin">
			<h2 class="form-signin-heading">恒昌-鹰眼平台</h2>
			<label for="iUserName" class="sr-only"></label> <input
				type="text" id="iUserName" name="iUserName" class="form-control"
				placeholder="用户名" required autofocus> <label
				for="iPassword" class="sr-only"></label> <input
				type="password" id="iPassword" name="iPassword" class="form-control"
				placeholder="密码" required>

			<button class="btn btn-lg btn-primary btn-block" type="button" id="loginButton" onclick="doLogin()">登陆</button>
		</form>

	</div>
	<!-- /container -->
</body>
</html>
